' BASIC Anywhere Machine version of B+'s QB64 program by Charlie Veniot ' as found at https://qb64phoenix.com/forum/showthread.php?tid=162&pid=2959#pid2959 ' _Title "The Hypotrochoid Show" 'for QB64 B+ 2019-07-18 Const xmax = 700, ymax = 700 Screen _NewImage(xmax, ymax, 27) declare Sub fcirc (CX As Long, CY As Long, R As Long, C As Long) c2 = &HFFBB0000 xc = xmax / 2: yc = ymax / 2: r = yc * .5: st = 1 / (2 * _Pi * r) n = 0: m = 3 do m = m + 1 For n = 5 To 30 Step .05 Cls For a = 0 To 2 * _Pi Step st xReturn = xc + r * (Cos(a) + Cos(n * a) / 3 + Sin(m * a) / 2) yReturn = yc + r * (Sin(a) + Sin(n * a) / 3 + Cos(m * a) / 2) fcirc (xReturn, yReturn, 10, _RGB32(0, 200, 0)) fcirc (xReturn, yReturn, 4, c2) Next Print "m = "; m; " n = "; n _delay 0.001 Next _Delay 1 loop Sub fcirc (CX As Long, CY As Long, R As Long, C As Long) Dim Radius As Long, RadiusError As Long Dim X As Long, Y As Long Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0 If Radius = 0 Then PSet (CX, CY), C: Exit Sub Line (CX - X, CY)-(CX + X, CY), C, BF While X > Y RadiusError = RadiusError + Y * 2 + 1 If RadiusError >= 0 Then If X <> Y + 1 Then Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF End If X = X - 1 RadiusError = RadiusError - X * 2 End If Y = Y + 1 Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF Wend End Sub